import React from 'react'
import {Outlet ,  useNavigate} from 'react-router-dom' 
/* 

  useNavigate  三种传参 
  1.search传参
  2.state传参
  3.params传参

*/ 


export default function Home() {
  const navigate = useNavigate();

  const GoMusicHandle = () => {
    navigate("/main/home/music/001/?name=厉飞雨" , {
      state: [
        {id: "001" , name:"海阔天空"},
        {id: "002" , name:"冷夜雨"},
        {id: "003" , name:"等一分钟"},
      ]
    }) 
  }

  const GoNewsHandle = () => {
    navigate("/main/home/news/002/?name=韩立" , {
      state: [
        {id: "001" , name:"原来"},
        {id: "002" , name:"春泥"},
        {id: "003" , name:"秋天不回来"},
      ]
    })
  }

  return (
    <div>
      <h3>home</h3>
      <button onClick={GoMusicHandle}>音乐</button>
      <button onClick={GoNewsHandle}>新闻</button>
      <Outlet/>
    </div>
  )
}
